home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / winsock / ircii2-6.zip / SRC\IRCII-2.6\INCLUDE\TALKD.H < prev    next >
C/C++ Source or Header  |  1994-12-28  |  3KB  |  92 lines

  1. /*
  2.  * Copyright (c) 1983 Regents of the University of California.
  3.  * All rights reserved.  The Berkeley software License Agreement
  4.  * specifies the terms and conditions for redistribution.
  5.  *
  6.  *    @(#)talkd.h    5.2 (Berkeley) 3/13/86
  7.  */
  8.  
  9. #ifndef _TALKD_H_
  10. #define _TALKD_H_
  11.  
  12. #include <sys/types.h>
  13. #ifdef notdef
  14. #include <sys/socket.h>        /* this taken out because ultrix is lame */
  15. #endif
  16. /*
  17.  * This describes the protocol used by the talk server and clients.
  18.  *
  19.  * The talk server acts a repository of invitations, responding to
  20.  * requests by clients wishing to rendezvous for the purpose of
  21.  * holding a conversation.  In normal operation, a client, the caller,
  22.  * initiates a rendezvous by sending a CTL_MSG to the server of
  23.  * type LOOK_UP.  This causes the server to search its invitation
  24.  * tables to check if an invitation currently exists for the caller
  25.  * (to speak to the callee specified in the message).  If the lookup
  26.  * fails, the caller then sends an ANNOUNCE message causing the server
  27.  * to broadcast an announcement on the callee's login ports requesting
  28.  * contact.  When the callee responds, the local server uses the
  29.  * recorded invitation to respond with the appropriate rendezvous
  30.  * address and the caller and callee client programs establish a
  31.  * stream connection through which the conversation takes place.
  32.  */
  33.  
  34. /*
  35.  * Client->server request message format.
  36.  */
  37. typedef struct {
  38.     u_char    vers;        /* protocol version */
  39.     u_char    type;        /* request type, see below */
  40.     u_char    answer;        /* not used */
  41.     u_char    pad;
  42.     u_long    id_num;        /* message id */
  43.     struct    sockaddr addr;
  44.     struct    sockaddr ctl_addr;
  45.     long    pid;        /* caller's process id */
  46. #define    NAME_SIZE    12
  47.     char    l_name[NAME_SIZE];/* caller's name */
  48.     char    r_name[NAME_SIZE];/* callee's name */
  49. #define    TTY_SIZE    16
  50.     char    r_tty[TTY_SIZE];/* callee's tty name */
  51. } CTL_MSG;
  52.  
  53. /*
  54.  * Server->client response message format.
  55.  */
  56. typedef struct {
  57.     u_char    vers;        /* protocol version */
  58.     u_char    type;        /* type of request message, see below */
  59.     u_char    answer;        /* respose to request message, see below */
  60.     u_char    pad;
  61.     u_long    id_num;        /* message id */
  62.     struct    sockaddr addr;    /* address for establishing conversation */
  63. } CTL_RESPONSE;
  64.  
  65. #define    TALK_VERSION    1        /* protocol version */
  66.  
  67. /* message type values */
  68. #define LEAVE_INVITE    0    /* leave invitation with server */
  69. #define LOOK_UP        1    /* check for invitation by callee */
  70. #define DELETE        2    /* delete invitation by caller */
  71. #define ANNOUNCE    3    /* announce invitation by caller */
  72.  
  73. /* answer values */
  74. #define SUCCESS        0    /* operation completed properly */
  75. #define NOT_HERE    1    /* callee not logged in */
  76. #define FAILED        2    /* operation failed for unexplained reason */
  77. #define MACHINE_UNKNOWN    3    /* caller's machine name unknown */
  78. #define PERMISSION_DENIED 4    /* callee's tty doesn't permit announce */
  79. #define UNKNOWN_REQUEST    5    /* request has invalid type value */
  80. #define    BADVERSION    6    /* request has invalid protocol version */
  81. #define    BADADDR        7    /* request has invalid addr value */
  82. #define    BADCTLADDR    8    /* request has invalid ctl_addr value */
  83.  
  84. /*
  85.  * Operational parameters.
  86.  */
  87. #define MAX_LIFE    60    /* max time daemon saves invitations */
  88. /* RING_WAIT should be 10's of seconds less than MAX_LIFE */
  89. #define RING_WAIT    30    /* time to wait before resending invitation */
  90.  
  91. #endif /* _TALKD_H_ */
  92.